//table头信息 不变
var cd_columnData = [
    {
        "Width": "10%",
        "ColumnName": "<input type='checkbox' id='title-dataManage-table-checkbox' name='title-table-checkbox'/>"
    },
    {"Width": "9%", "ColumnName": "ID"},
    {"Width": "9%", "ColumnName": "客户名称"},
    {"Width": "8%", "ColumnName": "责任人"},
    {"Width": "9%", "ColumnName": "客户类型"},
    {"Width": "9%", "ColumnName": "客户等级"},
    {"Width": "8%", "ColumnName": "联系人"},
    {"Width": "8%", "ColumnName": "手机号"},
    {"Width": "9%", "ColumnName": "身份证"},
    {"Width": "7%", "ColumnName": "来源"},
    {"Width": "9%", "ColumnName": "所属行业"},
    {"Width": "10%", "ColumnName": "录入时间"}
];

//用户管理分页函数
var gotoPage = function (index) {
    var url = webPath + "/crm/1";
    //TODO FORm val()
    var postData = $("#m-customerForm").serialize();
    postData.pageNumber = index;
    postData.pageSize = pageSize;
    var options = {"passArguments": index};
    postAjax(url, postData, gotoPageSuccess, options);
};

var gotoPageSuccess = function (result, passArguments) {
    //2.TODO 数据名改变
    var columnList = ["customerId", "customerName", "responsiblePerson", "customerType", "customerGrade", "contact",
        "phoneNumber", "idNumber", "source", "industry", "recordTime"];
    //3.TODO remove
    var result = '{"totalNumber":3,"list":[{"customerId":"33", "customerName":"张三", "customerGrade":"潜在客户",' +
        '"idNumber":"333333333333333333","recordTime":"2015-6-9","contact":"李四",' +
        '"responsiblePerson":"责任人","customerType":"生产企业","source":"网站注册","phoneNumber":"111111111",' +
        '"industry":"钢铁"}]}';
    //$.post(url, postData, function (result) {
    cleanTableAndPage("dataManageTable");
    var jsonData = $.parseJSON(result);
    //画table
    $("#dataManageTable").MakeTable(true, cd_columnData, jsonData.list, tableClass, columnList);
    //画分页
    $("#dataManageTable").after(comPagination(passArguments, pageSize, jsonData.totalNumber, "gotoPage", "dataManageP"));
    //});
}

//查询按钮行为 TODO Change
//$('#searchCRecordBtn').click(function () {
//    gotoPage(1);
//});

//获取id 方便提交 TODO Change
//var getContectRecordId = function (that) {
//    return that.closest("tr").find("td div")[1].innerHTML;
//}